package com.yitongmao.custom;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

/*
* 作者：梁伟航 on 2017/7/16 13:26
* 类的用途：
*/
public class CustomRelativeLayout extends RelativeLayout{
    private onLayoutKeyChange mLayoutKeyChange;

    public CustomRelativeLayout(Context context) {
        super(context);
    }

    public CustomRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    /**
     * @param changed 布局发生改变 ture 没有改变False * @param l * @param t * @param r * @param b
     */
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
        //Log.e("onLayout", "onLayout: b "+b);
        if (changed) mLayoutKeyChange.onLayoutKeyChange(b);
    }

    public void setonLayoutKeyChange(onLayoutKeyChange layoutKeyChange) {
        mLayoutKeyChange = layoutKeyChange;
    }

    public interface onLayoutKeyChange {
        /**
         * 虚拟键盘状态监听 * * @param b 布局距离底部的布局
         */
        void onLayoutKeyChange(int b);
    }
}
